<template>
    <div class="asn-button">
        <el-button :type="type" :size="size" :disabled="disabled" @click="click"><i :class="icontfont" /> {{ name
        }}</el-button>
    </div>
</template>

<script>
export default {
    props: {
        type: {
            type: String,
            default: 'primary'
        },
        name: {
            type: String,
            default: ''
        },
        size: {
            type: String,
            default: 'small'
        },
        disabled: {
            type: Boolean,
            default: false
        },
        icon: {
            type: String,
            default: ''
        }
    },
    computed: {
        icontfont() {
            switch (this.icon) {
                case 'add':
                    return 'el-icon-plus'
                    break;
                case 'edit':
                    return 'el-icon-edit'
                    break;
                case 'delete':
                    return 'el-icon-delete'
                    break;
                case 'search':
                    return 'el-icon-search'
                    break;
                case 'refresh':
                    return 'el-icon-refresh'
                    break;
                case 'upload':
                    return 'el-icon-upload';
                    break;
                default: '';
                    break
            }
        }
    },
    methods: {
        click() {
            this.$emit('click')
        }
    }
}
</script>

<style lang="scss" scoped>
.asn-button {}
</style>